<template>
  <view class="page">
		<view class="header">
			<view class="locationName">
				<uni-icons type="home-filled" size="20" color="#0000ff"></uni-icons>
				<text>石家庄</text>
			</view>
			<!-- 搜索功能 -->
			<view class="uni-search-box">
				<uni-search-bar ref="searchBar" radius="100" cancelButton="none" disabled placeholder="请输入关键字"/>
			</view>
		</view>
		<!-- 轮播图开始 -->
		<view class="banner_wrapper">
			<unicloud-db v-slot:default="{data, loading, error, options}" collection="opendb-banner">
				<view v-if="error">{{error.message}}</view>
				<view v-else>
					<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
					  <swiper-item v-for="(item, index) in data" :key="item._id">
					    <view class="swiper-item">
					      <image class="banner-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" />
					    </view>
					  </swiper-item>
					</swiper>
				</view>
			</unicloud-db>
		</view>
		<!-- 轮播图结束 -->
	</view>
</template>

<script>
  export default {
    data() {
      return {
		indicatorDots: true,
		autoplay: true,
		interval: 2000,
		duration: 500
      }
    },
    methods: {

    }
  }
</script>

<style scoped>
	view {
		display: flex;
		box-sizing: border-box;
		flex-direction: column;
	}
	
	.pages {
		background-color: #FFFFFF;
	}
	
	.header{
		display: flex;
		flex-direction: row;
		padding-left: 10px;
	}
	
	.locationName{
		display: flex;
		flex-direction: row;
		height: 50px;
		line-height: 50px;
		font-size: 12px;
	}
	
	.uni-search-box {
		background-color: #FFFFFF;
		height: 50px;
		width: 580rpx;
	}
	.swiper-item{
			width: 750rpx;
			height: 315rpx;
			line-height: 315rpx; 
			/* 文字在水平方向居中 */
			text-align: center;
		}
		.uni-margin-wrap{
			margin-top: 5rpx;
		}
		.swiper{
			height: 315rpx;
		}
		.banner-image {
			width: 750rpx;
			height: 315rpx;
		}	
</style>
